<!DOCTYPE HTML>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title>斯坦德社区</title>
    <head th:insert="~{import :: head}"></head>
    <style>
        .icon-txt-hot {
            background: #ff9406;
        }

        .icon-txt-new{
            background-color:#ff3852;
        }

        .icon-top{
            display: inline-block;
            width: 12px;
            height: 13px;
            background: url(http://10.19.1.64/deportal-api/resource/upload/image/1638869823609_490icon_top.png);
        }

        .icon-txt {
            display: inline-block;
            width: 16px;
            font-size: 12px;
            height: 16px;
            line-height: 16px;
            color: #fff;
            border-radius: 2px;
            text-align: center;
            margin-left: 4px;
        }

        .ranktop{
            color: #ff8200;
            margin-right: 2px;
        }

        .std-hot-1,.std-hot-2,.std-hot-3{
            color: #f26d5f;
            font-weight: bold;
        }
    </style>
</head>
<script type="application/javascript">
    window.onload = function () {
        var closable = window.localStorage.getItem("closable");
        if (closable == "true") {
            window.close();
            window.localStorage.removeItem("closable");
        }
    }
</script>
<body>
<div th:insert="~{navigation :: nav}"></div>
<div class="container-fluid main">
    <div class="row content_index">
        <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
            <h3><span class="glyphicon glyphicon-list" aria-hidden="true"></span> 发现</h3>
            <ul class="nav nav-tabs">
                <li role="presentation" th:class="${sort == 'new' || sort == '' ? 'active':''}">
                    <a th:href="@{/(sort='new')}">最新</a>
                </li>
                <li role="presentation" th:each="tag : ${tags}" th:class="${sort == tag ? 'active' : ''}">
                    <a th:href="@{/(page=1,search=${search},tag=${tag},sort=${tag})}" th:text="${tag}">最新</a>
                </li>
                <li role="presentation" th:class="${sort == 'hot30' ? 'active':''}">
                    <a th:href="@{/(sort='hot30')}">30天最热</a>
                </li>
                <li role="presentation" th:class="${sort == 'hot7' ? 'active':''}">
                    <a th:href="@{/(sort='hot7')}">7天最热</a>
                </li>
<!--                <li role="presentation" th:class="${sort == 'hot' ? 'active':''}">-->
<!--                    <a th:href="@{/(sort='hot')}">最热</a>-->
<!--                </li>-->
                <li role="presentation" th:class="${sort == 'no' ? 'active':''}">
                    <a th:href="@{/(sort='no')}" class="red">消灭零回复</a>
                </li>
            </ul>

            <div class="row">
                <div class="col-lg-8 col-md-12 col-sm-12 col-xs-12">
                    <div class="media" th:each="question : ${pagination.data}">
                        <div class="media-left">
                            <a href="#">
                                <img class="media-object img-rounded"
                                     th:src="${question.anonymous ? 'holder.js/38x38?theme=sky&text=匿名' : question.user.avatarUrl != null ? question.user.avatarUrl : 'holder.js/38x38?theme=sky&text=' + #strings.substring(question.user.name,#strings.length(question.user.name) - 2)}">
                            </a>
                        </div>
                        <div class="media-body">
                            <h5 class="media-heading">
                                <span style="color: #c74747" th:if="${question.sticky >= 1}">[置顶] </span><a th:href="@{'/question/'+ ${question.id}}" th:text="${question.title}"></a>
                            </h5>
                            <span class="text-desc"><span th:text="${question.commentCount}"></span> 个回复 • <span
                                    th:text="${question.viewCount}"></span> 次浏览 • <span
                                    th:text="${#dates.format(question.gmtCreate,'yyyy-MM-dd HH:mm')}"></span></span>
                        </div>
                    </div>
                </div>
                <div class="col-lg-4 hidden-md hidden-sm hidden-xs" style="margin-top: 10px; border-left: 2px solid #ddd;">
                    <div class="media" th:each="question, iterStat : ${hots.data}">
                        <div class="media-body">
                            <h5 class="media-heading">
                                <i class="ranktop" th:classappend="${iterStat.index == 0 ? 'icon-top' : 'std-hot-' + iterStat.index}" th:text="${iterStat.index == 0 ? '' : iterStat.index}"></i>
                                <span style="color: #c74747" th:if="${question.sticky >= 1}">[置顶] </span><a th:href="@{'/question/'+ ${question.id}}" th:text="${question.title}"></a>
                            </h5>
                            <span class="text-desc"><span th:text="${question.commentCount}"></span> 个回复 • <span
                                    th:text="${question.viewCount}"></span> 次浏览 • <span
                                    th:text="${#dates.format(question.gmtCreate,'yyyy-MM-dd HH:mm')}"></span></span>
                            <i class="icon-txt" th:classappend="${((new java.util.Date().getTime()) - question.gmtCreate) < (3 * 60 * 60 * 24 * 1000) ? 'icon-txt-new' : 'icon-txt-hot'}" th:text="${((new java.util.Date().getTime()) - question.gmtCreate) < (3 * 60 * 60 * 24 * 1000) ? '新' : '热'}">热</i>
                        </div>
                    </div>
                </div>
            </div>
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li th:if="${pagination.showFirstPage}">
                        <a th:href="@{/(page=1,search=${search},tag=${tag},sort=${sort})}" aria-label="Previous">
                            <span aria-hidden="true">&lt;&lt;</span>
                        </a>
                    </li>
                    <li th:if="${pagination.showPrevious}">
                        <a th:href="@{/(page=${pagination.page - 1},search=${search},tag=${tag},sort=${sort})}"
                           aria-label="Previous">
                            <span aria-hidden="true">&lt;</span>
                        </a>
                    </li>

                    <li th:each="page : ${pagination.pages}" th:class="${pagination.page == page}? 'active' : ''">
                        <a th:href="@{/(page=${page},search=${search},tag=${tag},sort=${sort})}" th:text="${page}"></a>
                    </li>

                    <li th:if="${pagination.showNext}">
                        <a th:href="@{/(page=${pagination.page +1 },search=${search},tag=${tag},sort=${sort})}"
                           aria-label="Previous">
                            <span aria-hidden="true">&gt;</span>
                        </a>
                    </li>
                    <li th:if="${pagination.showEndPage}">
                        <a th:href="@{/(page=${pagination.totalPage},search=${search},tag=${tag},sort=${sort})}"
                           aria-label="Previous">
                            <span aria-hidden="true">&gt;&gt;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
<!--        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">-->
<!--            &lt;!&ndash;相关问题&ndash;&gt;-->
<!--            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 tags_index">-->
<!--                <h4>热门标签</h4>-->
<!--                <a th:each="tag : ${tags}" th:href="@{/(page=1,search=${search},tag=${tag},sort=${sort})}"-->
<!--                   th:text="${tag}" class="community-tag"></a>-->
<!--            </div>-->
<!--        </div>-->
    </div>
</div>
<div th:insert="~{footer :: foot}"></div>
<script src="https://cdn.bootcss.com/holder/2.9.6/holder.min.js"></script>
</body>
</html>